package com.coolpad.job.device.config;

import com.coolpad.job.device.model.Response;
import com.coolpad.job.device.model.ResponseDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 功能描述:<br/>
 *
 * @Author:shengtao_yang
 * @Date: 2020/12/21 13:26
 * @since: 1.0.0
 */
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {

    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public ResponseDTO handler(Exception e){

        log.error("系统异常",e);
        return Response.exception.build();
    }
}
